Use getline and >> when read file C++ - Stack Overflow Because data from file look like this: line 1 is name (first last), next line is score ... After reading the last score, the line break is still sitting on the input buffer.